<div class="content-header"><h3><i class="fa fa-file-image-o"></i> Choose your Wallpaper</h3></div>
<div class="wallpapers">
	
</div>
<div class="content-header"><h3><i class="fa fa-file-image-o"></i> Choose your Theme</h3></div>
<div class="themes">
	<ul id="nav-themes">
		<li><a href="#" rel="assets/css/themes/start.css">Black</a></li>
		<li><a href="#" rel="assets/css/themes/blue.css">Blue</a></li>
		<li><a href="#" rel="assets/css/themes/green.css">Green</a></li>
		<li><a href="#" rel="assets/css/themes/red.css">Red</a></li>
		<li><a href="#" rel="assets/css/themes/brin.css">Brin</a></li>
	</ul>
</div>
<script>
	
	$(document).ready(function() {
	
    $.ajax({
  		url: "assets/img/wallpapers/",
  		success: function(data){
	     	$(data).find("td > a").each(function(){

	        	 //alert($(this).attr("href"));
	        	 if($(this).attr("href") != '/avivo/assets/img/'){
		        	 var wallpaper = '<div class="col-md-4 wallpaper"><a href="#" onclick="choseWallpaper(\''+ $(this).attr("href") +'\')"><img src="assets/img/wallpapers/'+ $(this).attr("href") +'" /></a></div>';
		        	 $('.wallpapers').append(wallpaper);
	        	 }
	     	});
  		}
	});
    $("#nav-themes li a").click(function() { 
		$("#theme").attr("href",$(this).attr('rel'));
		$.cookie("css",$(this).attr('rel'));
		return false;
	});
});

function choseWallpaper(wallpaper){
	//alert(wallpaper);
	$('body').css('backgroundImage', 'url("assets/img/wallpapers/'+wallpaper+'")');
	$.cookie("wallpaper", wallpaper);
}
</script>